<!--{include file='common/footer.htm'}-->
<script type="text/javascript" src="/static/javascript/gen_validatorv4.js"></script>
<!--//
  <script type="text/javascript" src="/static/javascript/uploader/header.js"></script>
-->
<script type="text/javascript" src="/static/javascript/uploader/util.js"></script>
<script type="text/javascript" src="/static/javascript/uploader/button.js"></script>
<script type="text/javascript" src="/static/javascript/uploader/handler.base.js"></script>
<script type="text/javascript" src="/static/javascript/uploader/handler.form.js"></script>
<script type="text/javascript" src="/static/javascript/uploader/handler.xhr.js"></script>
<script type="text/javascript" src="/static/javascript/uploader/uploader.basic.js"></script>
<script type="text/javascript" src="/static/javascript/uploader/dnd.js"></script>
<!--//
  <script type="text/javascript" src="/static/javascript/uploader/uploader.js"></script>
  //-->
<script type="text/javascript" src="/static/javascript/uploader/jquery-plugin.js"></script>
<script type="text/javascript" src="/static/form/view.js"></script>
<!--{literal}-->
<script type="text/javascript">
	$('.dropdown-toggle').dropdown();
	//$().dropdown('toggle');
	$(".collapse").collapse();
</script>
<!--{/literal}-->
<!--{literal}-->
<script type="text/javascript">
	var city = {};
	var district = {};
	function loadCity(pid) {
		if (city[pid] !== undefined) {
			$("#sel_city").empty().append(city[pid]).trigger('change');
		} else {
			$.get('/ajax.php?ajax=1&action=queryCity&prvId=' + pid, function(
					html) {
				$("#sel_city").empty().append(html).trigger('change');
				city[pid] = html;
			});
		}
	}
	function loadDistrict(cid) {
		if (district[cid] !== undefined) {
			$("#sel_district").empty().append(district[cid]);
		} else {
			$.get('/ajax.php?ajax=1&action=queryDistrict&cid=' + cid, function(
					html) {
				$("#sel_district").empty().append(html);
				district[cid] = html;
			});
		}
	}
	$(document).ready(function() {
		// 页面载入完成市获取显示省份的所辖城市
		loadCity($("#sel_prv").val());
		// 省份变化后更新城市列表，缓存在客户端
		$("#sel_prv").change(function() {
			loadCity($("#sel_prv").val());
		});
		$("#sel_city").change(function() {
			loadDistrict($("#sel_city").val());
		});

		// 处理错误样式
		$(".help-inline").each(function() {
			if ($(this).html() != "") {
				$(this).parent().parent(".control-group").addClass("error");
			}
		});
		// 处理提交
		$("#form-submit").click(function() {
			$("#form_userregister").submit();
		});

	});
</script>
<!--{/literal}-->
<!--{literal}-->
<script type="text/javascript">
	$(document).ready(
			function() {
				var errorHandler = function(event, id, fileName, reason) {
					qq.log("id: " + id + ", fileName: " + fileName
							+ ", reason: " + reason);
				};

				var fileNum = 0;

				$('#pic_upload').fineUploader({
					debug : true,
					uploaderType : 'basic',
					button : $("#upbtn"),
					multiple : false,
					request : {
						endpoint : "/ajax.php?ajax=1&action=upload",
						paramsInBody : false,
						params : {
							fileNum : function() {
								fileNum += 1;
								return fileNum;
							}
						}
					},
					validation : {
						allowedExtensions : [ "jpg", "jpeg", "gif", "png" ],
						acceptFiles : "image/jpeg,image/png,image/gif"
					},
					chunking : {
						enabled : true
					},
					resume : {
						enabled : true
					},
					retry : {
						enableAuto : true,
						showButton : true
					},
					text : {
						uploadButton : "上传图片",
						cancelButton : "取消",
						retry : "重试",
						failUpload : "上传失败"
					}
				}).on('error', errorHandler).on('upload', function(id, name) {
					$(this).fineUploader('setParams', {
						'form_seed' : $("input#form_seed").val()
					});
				}).on(
						'uploadChunk resume',
						function(event, id, fileName, chunkData) {
							qq.log('on' + event.type + ' -  ID: ' + id
									+ ", FILENAME: " + fileName
									+ ", PARTINDEX: " + chunkData.partIndex
									+ ", STARTBYTE: " + chunkData.startByte
									+ ", ENDBYTE: " + chunkData.endByte
									+ ", PARTCOUNT: " + chunkData.totalParts);
						}).on(
						'complete',
						function(event, id, name, responseJSON) {
							thumbimg = $("<img>").attr('src',
									responseJSON.thumbnail).addClass(
									'img-polaroid');
							if ($(this).multiple) {
								$(this).append(thumbimg);
							} else {
								$(this).empty().append(thumbimg);
							}
						});
			});
</script>
<!--{/literal}-->
<!--{include file='common/htmfooter.htm'}-->